package com.changgou.search.canal;

import com.changgou.search.canal.conf.RabbitMqConfig;
import com.changgou.search.service.ESManagerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

//监听上架队列,
@Component
public class GoodsUpListener {

    @Autowired
    private ESManagerService esManagerService;

    @RabbitListener(queues = RabbitMqConfig.SEARCH_ADD_QUEUE)
    public void GOODS_UP_EXCHANGE(String spuId){
        System.out.println("监听到有商品上架了 SpuId为 : " +spuId);
        esManagerService.importDataBySpuId(spuId);
        System.out.println("ES对应商品信息添加成功");


    }



}
